﻿Imports DTO
Imports DAL

Public Class TipoPagamentoBLL

#Region "Métodos"

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Sub Incluir(tipoPagamento As TipoPagamentoDTO)
        Dim dalTipoPagamento As New TipoPagamentoDAL
        Dim dtoTipoPagamento As New TipoPagamentoDTO
        Try
            dtoTipoPagamento = dalTipoPagamento.Consultar(tipoPagamento.pNome)
            If IsNothing(dtoTipoPagamento) Then
                dalTipoPagamento.Incluir(tipoPagamento)
            End If

        Catch ex As Exception
            Throw ex
        End Try

    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="tipoPagamento"></param>
    ''' <remarks></remarks>
    Sub Alterar(tipoPagamento As TipoPagamentoDTO)
        Dim dalTipoPagamento As New TipoPagamentoDAL

        Try
            dalTipoPagamento.Alterar(tipoPagamento)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="codigo"></param>
    ''' <remarks></remarks>
    Sub Excluir(codigo As Integer)
        Dim dalTipoPagamento As New TipoPagamentoDAL
        Try
            dalTipoPagamento.Excluir(codigo)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="nomeTipoPagamento"></param>
    ''' <remarks></remarks>
    Sub Consultar(nomeTipoPagamento As String)
        Dim dalTipoPagamento As New TipoPagamentoDAL
        Try
            dalTipoPagamento.Consultar(nomeTipoPagamento)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function Listar() As List(Of TipoPagamentoDTO)
        Dim dtoTipoPagamento As List(Of TipoPagamentoDTO)
        Dim dalTipoPagamento As New TipoPagamentoDAL

        Try

            dtoTipoPagamento = dalTipoPagamento.Listar()
            Return dtoTipoPagamento
        Catch ex As Exception
            Throw ex
        End Try
    End Function

#End Region

End Class
